import { createRouter, createWebHashHistory } from "vue-router"
import IndexA from "../pages/qiandao.vue";
import IndexB from "../pages/pinglun.vue";
import IndexC from "../pages/paimin.vue";
import My from "../pages/my.vue";
import Login from "../denglu/Login.vue";
import shouye from "../pages/shouye.vue";

const router = createRouter({
    history: createWebHashHistory(),
    routes: [//路由表
        { path: '/', redirect: "/login" },
        { path: '/login', component: Login, meta: { title: '登陆' } },
        {
            path: '/shouye', name: 'shouye', component: shouye,
            children: [
                { path: '/indexa', component: IndexA, meta: { title: '签到' } },
                { path: '/indexb', component: IndexB, meta: { title: '评论' } },
                { path: '/indexc', component: IndexC, meta: { title: '排行' } },
                { path: '/my', component: My, meta: { title: '我的' } },
                { path: '/:match(.*)*', component: () => import('../components/404.vue') },//处理找不到或者错误组件
            ]
        },


    ],
    linkActiveClass: 'active'//路由响应时的样式
})
router.beforeEach((to, from, next) => {
    document.title = to.meta.title;
    next()
})
export default router